package com.pe1n.yangtaopai.bean;

import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by My on 2016/11/24.
 */

public class VersionBean {

    /**
     * status : 0
     * error : ok
     * data : {"version":2,"vsersion_url":"http://oh0vbg8a6.bkt.clouddn.com/app-debug.apk"}
     */

    @SerializedName("status")
    private int status;
    @SerializedName("error")
    private String error;
    @SerializedName("data")
    private DataData data;

    public static VersionBean objectFromData(String str) {

        return new Gson().fromJson(str, VersionBean.class);
    }

    public static List<VersionBean> arrayVersionBeanFromData(String str) {

        Type listType = new TypeToken<ArrayList<VersionBean>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }

    public DataData getData() {
        return data;
    }

    public void setData(DataData data) {
        this.data = data;
    }

    public static class DataData {
        /**
         * version : 2
         * vsersion_url : http://oh0vbg8a6.bkt.clouddn.com/app-debug.apk
         */

        @SerializedName("version")
        private int version;
        @SerializedName("vsersion_url")
        private String vsersionUrl;

        public static DataData objectFromData(String str) {

            return new Gson().fromJson(str, DataData.class);
        }

        public static List<DataData> arrayDataDataFromData(String str) {

            Type listType = new TypeToken<ArrayList<DataData>>() {
            }.getType();

            return new Gson().fromJson(str, listType);
        }

        public int getVersion() {
            return version;
        }

        public void setVersion(int version) {
            this.version = version;
        }

        public String getVsersionUrl() {
            return vsersionUrl;
        }

        public void setVsersionUrl(String vsersionUrl) {
            this.vsersionUrl = vsersionUrl;
        }
    }
}
